// 1 导入axios
import axios from 'axios'
// 1.1 导入element message组件
import { Message } from 'element-ui'


// 2 设置相关参数：基本路径、超时时间 等
axios.defaults.baseURL = 'http://localhost:10010/'
axios.defaults.timeout = 3000

/** 5 所有请求（每一个都是一个功能）
export function test(){
    return axios.get('/test')
}
*/

/**管理用户登录 */
export function login(admin){
    return axios.post('/admin/login',admin)
}

/**分页条件查询新闻 */
export function selectJournalismListByPage(queryInfo){
    return axios.post('/journalism/selectJournalismListByPage',queryInfo);
}
/**查询所有分类 */
export function selectCategoryList(){
    return axios.get('/category/selectCategoryList');
}
/**添加新闻 */
export function addJournalism(journalism){
    return axios.post('/journalism/addJournalism',journalism);
}
/**查询新闻详情 */
export function openSelectJournalismByJid(j_id){
    return axios.get('/journalism/openSelectJournalismByJid/'+j_id);
}
/**关闭新闻 */
export function deleteJournalismByJid(j_id){
    return axios.delete('/journalism/deleteJournalismByJid/'+j_id);
}
/**添加分类 */
export function addCategory(category){
    return axios.post('/category/addCategory',category);
}
/**删除分类 */
export function deleteCategoryByCid(c_id){
    return axios.delete('/category/deleteCategoryByCid/'+c_id);
}
/**查询所有小程序用户(分页+条件) */
export function selectPersonPage(queryInfo){
    return axios.post('/person/selectPersonPage',queryInfo);
}
/**查询用户详情(根据用户id) */
export function selectPersonDetail(p_id){
    return axios.get('/person/selectPersonDetail/'+p_id);
}
/**查询用户看过的新闻(根据用户id)+条件+分页 */
export function selectJournalismByPid(p_id,queryInfo){
    return axios.post('/person/selectJournalismByPid/'+p_id,queryInfo);
}
/**删除用户 */
export function deletePersonByPid(p_id){
    return axios.delete('/person/deletePersonByPid/'+p_id);
}
